package finger.service.impl;

import finger.dao.UserDao;
import finger.dao.impl.UserDaoimpl;
import finger.domain.User;
import finger.service.UserService;

public class UserServiceImpl implements UserService {
    UserDao dao = new UserDaoimpl();
    @Override
    public void registUser(User user) {
        dao.save(user);
    }

    @Override
    public User loginUser(String username, String password) {
        return dao.queryUserForUsernameAndPassword(username,password);
    }

    @Override
    public boolean existsUser(String username) {
        if(username==""&&username.length()<5){
            return true;
        }
        if(dao.queryUserForUsername(username)==null){
            return false;
        }
        return true;
    }
}
